<?php

	require_once 'includes/config.include';
	require_once MUKU_DOC_ROOT . 'lib/pageContent.class.php';
	require_once MUKU_DOC_ROOT . 'lib/postData.class.php';
	
	# db instance
	$db = dbConnection::getConnection();
	
	# smarty instance
	$smarty = smartyInstance::getInstance();
	
	# process post data
	if (!empty($_POST['submit_action'])) {
		$submitAction = $_POST['submit_action'];
		$submitActionHandler = postData::getSubmitActionInstance($submitAction, $_POST, $db, $smarty);
		if (is_array($submitActionHandler) && $submitActionHandler['result'] === FALSE) {
			$smarty->assign('action_response', 'Es ist ein Fehler aufgetreten!');
		} else {
			$submitActionHandler->executeAction();
		}
	}
	
	# content instance
	if (empty($_GET['action'])) {
		$action = 'home';
	} else {
		$action = $_GET['action'];
	}
	$pageContent = new pageContent($action, $db, $smarty);
	$pageContent->render();

?>
